package homelesspartners.client;

import homelesspartners.client.widgets.GiftTabWidget;
import homelesspartners.client.widgets.HomeTabWidget;
import homelesspartners.client.widgets.ThankyouTabWidget;
import homelesspartners.client.widgets.VolunteerTabWidget;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TabPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Index implements EntryPoint {

	public static final MyConstants MY_CONSTANTS = (MyConstants) GWT.create(MyConstants.class);

	private static final String APP_ID = "app";

	private static TabPanel tabs = new TabPanel();

	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {

		History.newItem("start");
		
		tabs.add(HomeTabWidget.getInstance(), MY_CONSTANTS.homeTab());
		tabs.add(GiftTabWidget.getInstance(), MY_CONSTANTS.giftTab());
		tabs.add(VolunteerTabWidget.getInstance(), MY_CONSTANTS.volunteersTab());
		tabs.add(ThankyouTabWidget.getInstance(), "Thank You");
		tabs.selectTab(0);
		RootPanel.get(APP_ID).add(tabs);
		ServerFacade.loadCities();		

	}

	public static void selectTab(int x) {
		tabs.selectTab(x);
	}

}
